package cms.jason.entity;

import com.cn.lotary.base.dao.AbstractEntity;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Jason
 */
@Entity
@Table(catalog = "cms", name = "permission", schema = "")
@XmlRootElement
public class Permission extends AbstractEntity {

    private static final long serialVersionUID = 1L;
    @Size(max = 45)
    @Column(length = 45)
    private String name;
    @Size(max = 45)
    @Column(length = 45)
    private String code;
    @Size(max = 45)
    @Column(length = 45)
    private String remark;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "permission")
    private List<Account> accountList;

    public Permission() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @XmlTransient
    public List<Account> getAccountList() {
        return accountList;
    }

    public void setAccountList(List<Account> accountList) {
        this.accountList = accountList;
    }

    @Override
    public String toString() {
        return "Permission{" + "name=" + name + ", code=" + code + ", remark=" + remark + '}';
    }
}
